3.4.95 \(\int \cos ^2(c+d x) (a+b \sin (c+d x))^2 \, dx\) [395]

Optimal. Leaf size=86 \[ \frac {1}{8} \left (4 a^2+b^2\right ) x-\frac {5 a b \cos ^3(c+d x)}{12 d}+\frac {\left (4 a^2+b^2\right ) \cos (c+d x) \sin (c+d x)}{8 d}-\frac {b \cos ^3(c+d x) (a+b \sin (c+d x))}{4 d} \]

[Out]

1/8*(4*a^2+b^2)*x-5/12*a*b*cos(d*x+c)^3/d+1/8*(4*a^2+b^2)*cos(d*x+c)*sin(d*x+c)/d-1/4*b*cos(d*x+c)^3*(a+b*sin(
d*x+c))/d

________________________________________________________________________________________

Rubi [A]
time = 0.06, antiderivative size = 86, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {2771, 2748, 2715, 8} \begin {gather*} \frac {\left (4 a^2+b^2\right ) \sin (c+d x) \cos (c+d x)}{8 d}+\frac {1}{8} x \left (4 a^2+b^2\right )-\frac {5 a b \cos ^3(c+d x)}{12 d}-\frac {b \cos ^3(c+d x) (a+b \sin (c+d x))}{4 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^2*(a + b*Sin[c + d*x])^2,x]

[Out]

((4*a^2 + b^2)*x)/8 - (5*a*b*Cos[c + d*x]^3)/(12*d) + ((4*a^2 + b^2)*Cos[c + d*x]*Sin[c + d*x])/(8*d) - (b*Cos
[c + d*x]^3*(a + b*Sin[c + d*x]))/(4*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2715

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d*x]*((b*Sin[c + d*x])^(n - 1)/(d*n))
, x] + Dist[b^2*((n - 1)/n), Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integ
erQ[2*n]

Rule 2748

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-b)*((g*Co
s[e + f*x])^(p + 1)/(f*g*(p + 1))), x] + Dist[a, Int[(g*Cos[e + f*x])^p, x], x] /; FreeQ[{a, b, e, f, g, p}, x
] && (IntegerQ[2*p] || NeQ[a^2 - b^2, 0])

Rule 2771

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_), x_Symbol] :> Simp[(-b)*(
g*Cos[e + f*x])^(p + 1)*((a + b*Sin[e + f*x])^(m - 1)/(f*g*(m + p))), x] + Dist[1/(m + p), Int[(g*Cos[e + f*x]
)^p*(a + b*Sin[e + f*x])^(m - 2)*(b^2*(m - 1) + a^2*(m + p) + a*b*(2*m + p - 1)*Sin[e + f*x]), x], x] /; FreeQ
[{a, b, e, f, g, p}, x] && NeQ[a^2 - b^2, 0] && GtQ[m, 1] && NeQ[m + p, 0] && (IntegersQ[2*m, 2*p] || IntegerQ
[m])

Rubi steps

\begin {align*} \int \cos ^2(c+d x) (a+b \sin (c+d x))^2 \, dx &=-\frac {b \cos ^3(c+d x) (a+b \sin (c+d x))}{4 d}+\frac {1}{4} \int \cos ^2(c+d x) \left (4 a^2+b^2+5 a b \sin (c+d x)\right ) \, dx\\ &=-\frac {5 a b \cos ^3(c+d x)}{12 d}-\frac {b \cos ^3(c+d x) (a+b \sin (c+d x))}{4 d}+\frac {1}{4} \left (4 a^2+b^2\right ) \int \cos ^2(c+d x) \, dx\\ &=-\frac {5 a b \cos ^3(c+d x)}{12 d}+\frac {\left (4 a^2+b^2\right ) \cos (c+d x) \sin (c+d x)}{8 d}-\frac {b \cos ^3(c+d x) (a+b \sin (c+d x))}{4 d}+\frac {1}{8} \left (4 a^2+b^2\right ) \int 1 \, dx\\ &=\frac {1}{8} \left (4 a^2+b^2\right ) x-\frac {5 a b \cos ^3(c+d x)}{12 d}+\frac {\left (4 a^2+b^2\right ) \cos (c+d x) \sin (c+d x)}{8 d}-\frac {b \cos ^3(c+d x) (a+b \sin (c+d x))}{4 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.25, size = 85, normalized size = 0.99 \begin {gather*} \frac {-48 a b \cos (c+d x)-16 a b \cos (3 (c+d x))+3 \left (16 a^2 c+4 b^2 c+16 a^2 d x+4 b^2 d x+8 a^2 \sin (2 (c+d x))-b^2 \sin (4 (c+d x))\right )}{96 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^2*(a + b*Sin[c + d*x])^2,x]

[Out]

(-48*a*b*Cos[c + d*x] - 16*a*b*Cos[3*(c + d*x)] + 3*(16*a^2*c + 4*b^2*c + 16*a^2*d*x + 4*b^2*d*x + 8*a^2*Sin[2
*(c + d*x)] - b^2*Sin[4*(c + d*x)]))/(96*d)

________________________________________________________________________________________

Maple [A]
time = 0.29, size = 86, normalized size = 1.00

method result size
risch \(\frac {a^{2} x}{2}+\frac {b^{2} x}{8}-\frac {a b \cos \left (d x +c \right )}{2 d}-\frac {\sin \left (4 d x +4 c \right ) b^{2}}{32 d}-\frac {a b \cos \left (3 d x +3 c \right )}{6 d}+\frac {a^{2} \sin \left (2 d x +2 c \right )}{4 d}\) \(77\)
derivativedivides \(\frac {b^{2} \left (-\frac {\sin \left (d x +c \right ) \left (\cos ^{3}\left (d x +c \right )\right )}{4}+\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{8}+\frac {d x}{8}+\frac {c}{8}\right )-\frac {2 a b \left (\cos ^{3}\left (d x +c \right )\right )}{3}+a^{2} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(86\)
default \(\frac {b^{2} \left (-\frac {\sin \left (d x +c \right ) \left (\cos ^{3}\left (d x +c \right )\right )}{4}+\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{8}+\frac {d x}{8}+\frac {c}{8}\right )-\frac {2 a b \left (\cos ^{3}\left (d x +c \right )\right )}{3}+a^{2} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(86\)
norman \(\frac {\left (\frac {a^{2}}{2}+\frac {b^{2}}{8}\right ) x +\left (2 a^{2}+\frac {b^{2}}{2}\right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (2 a^{2}+\frac {b^{2}}{2}\right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (3 a^{2}+\frac {3 b^{2}}{4}\right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {a^{2}}{2}+\frac {b^{2}}{8}\right ) x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {4 a b}{3 d}+\frac {\left (4 a^{2}-b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 d}-\frac {\left (4 a^{2}-b^{2}\right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}+\frac {\left (4 a^{2}+7 b^{2}\right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}-\frac {\left (4 a^{2}+7 b^{2}\right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}-\frac {4 a b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {4 a b \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {4 a b \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{4}}\) \(294\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^2*(a+b*sin(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(b^2*(-1/4*sin(d*x+c)*cos(d*x+c)^3+1/8*cos(d*x+c)*sin(d*x+c)+1/8*d*x+1/8*c)-2/3*a*b*cos(d*x+c)^3+a^2*(1/2*
cos(d*x+c)*sin(d*x+c)+1/2*d*x+1/2*c))

________________________________________________________________________________________

Maxima [A]
time = 0.28, size = 64, normalized size = 0.74 \begin {gather*} -\frac {64 \, a b \cos \left (d x + c\right )^{3} - 24 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} a^{2} - 3 \, {\left (4 \, d x + 4 \, c - \sin \left (4 \, d x + 4 \, c\right )\right )} b^{2}}{96 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*sin(d*x+c))^2,x, algorithm="maxima")

[Out]

-1/96*(64*a*b*cos(d*x + c)^3 - 24*(2*d*x + 2*c + sin(2*d*x + 2*c))*a^2 - 3*(4*d*x + 4*c - sin(4*d*x + 4*c))*b^
2)/d

________________________________________________________________________________________

Fricas [A]
time = 0.36, size = 70, normalized size = 0.81 \begin {gather*} -\frac {16 \, a b \cos \left (d x + c\right )^{3} - 3 \, {\left (4 \, a^{2} + b^{2}\right )} d x + 3 \, {\left (2 \, b^{2} \cos \left (d x + c\right )^{3} - {\left (4 \, a^{2} + b^{2}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{24 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*sin(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/24*(16*a*b*cos(d*x + c)^3 - 3*(4*a^2 + b^2)*d*x + 3*(2*b^2*cos(d*x + c)^3 - (4*a^2 + b^2)*cos(d*x + c))*sin
(d*x + c))/d

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 180 vs. \(2 (76) = 152\).
time = 0.19, size = 180, normalized size = 2.09 \begin {gather*} \begin {cases} \frac {a^{2} x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {a^{2} x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {a^{2} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} - \frac {2 a b \cos ^{3}{\left (c + d x \right )}}{3 d} + \frac {b^{2} x \sin ^{4}{\left (c + d x \right )}}{8} + \frac {b^{2} x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} + \frac {b^{2} x \cos ^{4}{\left (c + d x \right )}}{8} + \frac {b^{2} \sin ^{3}{\left (c + d x \right )} \cos {\left (c + d x \right )}}{8 d} - \frac {b^{2} \sin {\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{8 d} & \text {for}\: d \neq 0 \\x \left (a + b \sin {\left (c \right )}\right )^{2} \cos ^{2}{\left (c \right )} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**2*(a+b*sin(d*x+c))**2,x)

[Out]

Piecewise((a**2*x*sin(c + d*x)**2/2 + a**2*x*cos(c + d*x)**2/2 + a**2*sin(c + d*x)*cos(c + d*x)/(2*d) - 2*a*b*
cos(c + d*x)**3/(3*d) + b**2*x*sin(c + d*x)**4/8 + b**2*x*sin(c + d*x)**2*cos(c + d*x)**2/4 + b**2*x*cos(c + d
*x)**4/8 + b**2*sin(c + d*x)**3*cos(c + d*x)/(8*d) - b**2*sin(c + d*x)*cos(c + d*x)**3/(8*d), Ne(d, 0)), (x*(a
 + b*sin(c))**2*cos(c)**2, True))

________________________________________________________________________________________

Giac [A]
time = 3.81, size = 76, normalized size = 0.88 \begin {gather*} \frac {1}{8} \, {\left (4 \, a^{2} + b^{2}\right )} x - \frac {a b \cos \left (3 \, d x + 3 \, c\right )}{6 \, d} - \frac {a b \cos \left (d x + c\right )}{2 \, d} - \frac {b^{2} \sin \left (4 \, d x + 4 \, c\right )}{32 \, d} + \frac {a^{2} \sin \left (2 \, d x + 2 \, c\right )}{4 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*sin(d*x+c))^2,x, algorithm="giac")

[Out]

1/8*(4*a^2 + b^2)*x - 1/6*a*b*cos(3*d*x + 3*c)/d - 1/2*a*b*cos(d*x + c)/d - 1/32*b^2*sin(4*d*x + 4*c)/d + 1/4*
a^2*sin(2*d*x + 2*c)/d

________________________________________________________________________________________

Mupad [B]
time = 5.38, size = 71, normalized size = 0.83 \begin {gather*} \frac {6\,a^2\,\sin \left (2\,c+2\,d\,x\right )-\frac {3\,b^2\,\sin \left (4\,c+4\,d\,x\right )}{4}-12\,a\,b\,\cos \left (c+d\,x\right )-4\,a\,b\,\cos \left (3\,c+3\,d\,x\right )+12\,a^2\,d\,x+3\,b^2\,d\,x}{24\,d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)^2*(a + b*sin(c + d*x))^2,x)

[Out]

(6*a^2*sin(2*c + 2*d*x) - (3*b^2*sin(4*c + 4*d*x))/4 - 12*a*b*cos(c + d*x) - 4*a*b*cos(3*c + 3*d*x) + 12*a^2*d
*x + 3*b^2*d*x)/(24*d)

________________________________________________________________________________________